<?php
    include('header.php');
    include('submenu.php');
    
    $sql = 'SELECT * FROM subscribe ORDER BY s_id';
    $result = $db->Execute($sql);
    if($result->RecordCount()>0){
        $msg = '<button class="button">Export</button>';
        
        $sql = "SELECT cc_id,cc_code,cc_name FROM customer_company ORDER BY cc_code";
        $result = $db->Execute($sql);
        $company_list = '';
        while (!$result->EOF)
        {
            $company_list .=<<<packing_list
                <option value="{$result->fields['cc_id']}">{$result->fields['cc_code']} ({$result->fields['cc_name']})</option>
packing_list;
            
            $result->MoveNext();
        }
        $result->Close();
        
        $filter =<<<filter
        <form id="filter">
            <div id="about_us_company_msg_1_en" class="form_field">
                <p>Company : </p>
                <select name="cc_id" class="select input">
                    <option value=''>All</option>
                    {$company_list}
                </select>
            </div>
            <div id="about_us_company_msg_1_th" class="form_field">
                <p>Customer Type / Contact Type :</p>
                <input type="checkbox" name="c_web" class="checkbox" /> Web Development<br />
                <input type="checkbox" name="c_interactive" class="checkbox" /> Interactive Presentation<br />
                <input type="checkbox" name="c_video" class="checkbox" /> Video Presentation<br />
                <input type="checkbox" name="c_emag" class="checkbox" /> E-Magazine Service<br />
                <input type="checkbox" name="c_annual" class="checkbox" /> Annual Report<br />
                <input type="checkbox" name="c_printing" class="checkbox" /> Printing Service<br />
                <input type="checkbox" name="c_photography" class="checkbox" /> Digital Photography<br />
                <input type="checkbox" name="c_copywriter" class="checkbox" /> Copywriter & Translation Service<br />
                <input type="checkbox" name="c_dvd" class="checkbox" /> CD/DVD Production
            </div>
        </form>
filter;
    }else{
        $filter = '';
        $msg = 'ยังไม่มีข้อมูลลูกค้า.';
    }
?>
    <div class="grid_18" id="contents">
        
        <div id="contents_">
            <?php echo $filter; ?>
            <?php echo $msg; ?>
        </div>
        
    </div><!-- end .grid_18 -->
    <div class="clear">&nbsp;</div>
<?
    include('footer.php');
?>